/**
* Created by yyr on 2018/1/15
*已设立基金选项卡投资数据
*/
<template>
    <div>
        <div class="ca-box-border-top-none ca-p-22">
            <div class="ca-title">
                <h3>拟投资项目</h3>
                <div class="clear"></div>
            </div>
            <el-table
                stripe
                :data="quasiList"
                border
                style="width:100%"
                class="ca-table ca-m-t-10">
                <el-table-column
                    prop="itemName"
                    label="投资项目">
                    <template slot-scope="scope">
                        <el-button
                       type="text"
                       @click="goPreProjectDetail(scope.row.id)"
                       :disabled="scope.row.existence">{{scope.row.itemName}}</el-button>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="prostatus"
                    label="项目轮次">
                    <template slot-scope="scope">
                        {{scope.row.prostatus | getNameById('prostatus')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="industry"
                    label="行业">
                    <template slot-scope="scope">
                        {{scope.row.industry | getNameById('industry')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="companyNature"
                    label="企业性质">
                    <template slot-scope="scope">
                        {{scope.row.companyNature | getNameById('nature')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="address"
                    label="注册地址">
                    <template slot-scope="scope">
                        {{scope.row.address | getRegionName(scope.row.address)}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investRole"
                    label="投资角色">
                    <template slot-scope="scope">
                        {{scope.row.investRole | getNameById('investRole')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="postValuation"
                    :render-header="renderTitle"
                    label="投后估值</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.postValuation | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investAmount"
                    :render-header="renderTitle"
                    label="拟投资规模</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.investAmount | format1}}
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <div class="ca-box ca-p-22 ca-m-t-20">
            <div class="ca-title">
                <h3>已投资项目</h3>
                <div class="clear"></div>
            </div>
            <el-table
                stripe
                :data="investedList"
                border
                style="width:100%"
                class="ca-table ca-m-t-10">
                <el-table-column
                    prop="itemName"
                    label="投资项目">
                    <template slot-scope="scope">
                        <el-button
                        type="text"
                        @click="goProjectDetail(scope.row.id)"
                        :disabled="scope.row.existence">{{scope.row.itemName}}</el-button>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investDate"
                    label="投资时间">
                </el-table-column>
                <el-table-column
                    prop="industry"
                    label="行业分类">
                    <template slot-scope="scope">
                        {{scope.row.industry | getNameById('industry')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="address"
                    label="注册地址">
                    <template slot-scope="scope">
                        {{scope.row.address | getRegionName(scope.row.address)}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investLoan"
                    :render-header="renderTitle"
                    label="项目总投资额</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.investLoan | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investAmount"
                    :render-header="renderTitle"
                    label="目前投资</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.investAmount | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="finalHolding"
                    :render-header="renderTitle"
                    label="目前持股数</br>(万股)">
                </el-table-column>
                <el-table-column
                    prop="holdScale"
                    label="持股比例(%)">
                    <template slot-scope="scope">
                        {{scope.row.holdScale * 100 | format1}}%
                    </template>
                </el-table-column>
                <el-table-column
                    prop="valuationAfter"
                    :render-header="renderTitle"
                    label="项目估值</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.valuationAfter | format1}}
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <div class="ca-box ca-p-22 ca-m-t-20">
            <div class="ca-title">
                <h3>已退出项目</h3>
                <div class="clear"></div>
            </div>
            <el-table
                stripe
                :data="exitList"
                border
                style="width:100%"
                class="ca-table ca-m-t-10">
                <el-table-column
                    prop="itemName"
                    label="投资项目">
                    <template slot-scope="scope">
                        <el-button
                        type="text"
                        @click="goProjectDetail(scope.row.id)"
                        :disabled="scope.row.existence">{{scope.row.itemName}}</el-button>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investDate"
                    label="投资时间">
                </el-table-column>
                <el-table-column
                    prop="industry"
                    label="行业分类">
                    <template slot-scope="scope">
                       {{scope.row.industry | getNameById('industry')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="address"
                    label="注册地址">
                    <template slot-scope="scope">
                        {{scope.row.address | getRegionName(scope.row.address)}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="investLoan"
                    :render-header="renderTitle"
                    label="初始投资金额</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.investLoan | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="exitDate"
                    label="退出时间">
                </el-table-column>
                <el-table-column
                    prop="exitTotalCapita"
                    :render-header="renderTitle"
                    label="退出总额</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.exitTotalCapita | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="bonusTotalCapita"
                    :render-header="renderTitle"
                    label="分红金额</br>(万元)">
                    <template slot-scope="scope">
                        {{scope.row.bonusTotalCapita | format1}}
                    </template>
                </el-table-column>5
                <el-table-column
                    prop="exitMultiple"
                    label="退出倍数">
                </el-table-column>
                <el-table-column
                    prop="irr"
                    label="IRR">
                    <template slot-scope="scope">
                       <span v-if="scope.row.irr"> {{scope.row.irr | format1}}%</span>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp'
    export default {
        data() {
            return {
                itemId: this.$route.params.fundId,
                quasiList: [],
                investedList: [],
                exitList: [],
            }
        },
        props: {
        },
        created() {
            this.getQuasiData();
            this.getInvestedData();
            this.getExitData();
        },
        mounted() {

        },
        methods: {
            getQuasiData() {
                apiHttp(api.QUASI_ITEM,{fundId: this.itemId}).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.quasiList = ret.data;
                    }
                })
            },
            getInvestedData() {
                apiHttp(api.INVESTED_ITEM,{fundId: this.itemId}).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.investedList = ret.data;
                    }
                })
            },
            getExitData() {
                apiHttp(api.EXIT_ITEM,{fundId: this.itemId}).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.exitList = ret.data;
                    }
                })
            },
            //跳转拟设立基金详情
            goPreProjectDetail(id) {
                this.$router.push({name: 'pre-investment-project', params: {itemId: id, tabIndex: 0, openWindow: true}})
            },
            //跳转项目详情
            goProjectDetail(id) {
                this.$router.push({name: 'invested-project-detail', params: {itemId: id, tabIndex: 0, openWindow: true}})
            }
        },
        components: {
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
